<?php
// 新建员工
?>
<div class="hr_15"></div>
<div class="form">
<?php 
if($model->isNewRecord){
	//表单提交的地址
	$action = $this->pre_module_url.'/memSub/createstaff';
	//选中的权限操作
	$actions = array();
}else{
	$action = $this->pre_module_url.'/memSub/updatestaff';
}
?>
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'adminer-form',
	'action'=>$action,
	'enableAjaxValidation'=>true,
	'enableClientValidation'=>true,
	'clientOptions'=>array('validateOnSubmit'=>true)
)); ?>
	<?php echo $form->hiddenField($model,'zda_id'); ?>
	<ul class="form_list form_list2">
		<li class="c_f">
			<span class="tit"><em class="xing">*</em>用户名：</span>
			<div class="cont f_l">
				<?php echo $form->textField($model,'zda_username',array('size'=>20,'maxlength'=>20,'class'=>'t_ipt ipt_bg w_250')); ?>
				<?php echo $form->error($model,'zda_username')?>
			</div>
		</li>
	<?php if($model->isNewRecord){ ?>
		<li class="c_f">
			<span class="tit"><em class="xing">*</em>密码：</span>
			<div class="cont f_l">
				<?php echo $form->passwordField($model,'zda_password',array('size'=>20,'maxlength'=>20,'class'=>'t_ipt ipt_bg w_250')); ?>
				<?php echo $form->error($model,'zda_password')?>
			</div>
		</li>
		<li class="c_f">
			<span class="tit"><em class="xing">*</em>重复密码：</span>
			<div class="cont f_l">
				<?php echo $form->passwordField($model,'re_password',array('size'=>20,'maxlength'=>20,'class'=>'t_ipt ipt_bg w_250')); ?>
				<?php echo $form->error($model,'re_password')?>
			</div>
		</li>
	<?php } ?>
		<li class="c_f">
			<span class="tit"><em class="xing">*</em>真实姓名：</span>
			<div class="cont f_l">
				<?php echo $form->textField($model,'zda_name',array('size'=>20,'maxlength'=>20,'class'=>'t_ipt ipt_bg w_250')); ?>
				<?php echo $form->error($model,'zda_name')?>
			</div>
		</li>
		<li class="c_f">
			<span class="tit"><em class="xing">*</em>姓别：</span>
			<div class="cont f_l">
				<?php echo $form->radioButtonList($model,'zda_sex',MemSub::model()->getSex(),array('labelOptions'=>array('class'=>'mr20'),'separator'=>'')); ?>
				<?php echo $form->error($model,'zda_sex'); ?>
			</div>
		</li>
		<li class="c_f">
			<span class="tit"><em class="xing">*</em>部门：</span>
			<div class="cont f_l">
				<?php echo $form->dropDownList($model,'zpc_id',CmpCat::model()->getCmpAccount(),array('id'=>'department','class'=>'s_ipt w_250 f_l'))?>
				<?php echo $form->error($model,'zpc_id'); ?>
			</div>
		</li>
		<li class="c_f">
			<span class="tit">职务：</span>
			<div class="cont f_l">
				<?php echo $form->textField($model,'zda_duties',array('size'=>20,'maxlength'=>20,'class'=>'t_ipt ipt_bg w_250')); ?>
				<?php echo $form->error($model,'zda_duties'); ?>
			</div>
		</li>
		<li class="c_f"><span class="tit">
			<em class="xing">*</em>权限角色：</span>
			<div class="cont f_l">
				<?php echo $form->dropDownList($model,'zag_id',AdmRole::model()->getRoleListData(),array('class'=>'s_ipt w_250'))?>
				<?php echo $form->error($model,'zag_id'); ?>
			</div>
		</li>
		<li class="c_f d_n"><span class="tit">
			<em class="xing">*</em>权限设置：</span>
			<div class="cont f_l">
				<a class="mem_btn mem_btn16" onclick="showRole();" href="javascript:" title="">设置权限</a>
			</div>
		</li>
		<li  id="set_authority" class="d_n"> 
			<span class="tit"></span>
				<ul class="ml100">
					<?php /*echo CHtml::label("角色：","task");
					//	echo $form->radioButtonList($model,'zpc_id_role',CmpCat::model()->getCmpRole(),array('separator'=>'\t')); 
			    	  	$tasks = AdmRole::model()->getCmpTask();
			    		foreach($tasks as $key=>$val){
			    			echo "<li class=\"item\"><label>".$val."</label><ul class=\"sub_list ml10\">";
			    			echo CHtml::checkBoxList("privilege[$key][]",$actions,AdmRole::model()->getTaskAction($key),array("checkAll"=>"all","template"=>"<li class=\"f_l\">{input}{label}&nbsp;&nbsp;</li>","separator"=>""))."<br>";
			    			echo "</ul></li>";
			    		}*/
			    	?>       
			</ul>
		</li>
		<li class="c_f"><span class="tit">&nbsp;</span>
			<div class="cont f_l">
				<?php echo CHtml::submitButton($model->isNewRecord? Yii::t('cmp','Create') : Yii::t('cmp','Save'),array('class'=>'mem_btn mem_btn18')); ?>
				<?php if(!$model->isNewRecord) echo CHtml::link('重置密码',array('resetPassword','id'=>$model->zda_id),array('class'=>'mem_btn mem_btn07'))?>
			</div>
		</li>

<?php $this->endWidget(); ?>
</div><!-- form -->

<script type="text/javascript">
function showRole(){
	$('#set_authority').toggle();
}
</script>
